Flag: Tornado!
Hurricane!
|
|
OllyDbg Memory Breakpoint Detection |
Debugging |
ap0x |
OllyPageGuard.zip |
March 11 2006 |
|
|
.386
.model flat, stdcall
option casemap :none ; case sensitive
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.data
Alloc dd ?
OLDProtect dd 02040001h
msgTitle db "Execution status:",0h
msgText1 db "No debugger detected!",0h
msgText2 db "Debugger detected!",0h
.code
start:
; MASM32 antiOlly example
; coded by ap0x
; Reversing Labs: http://ap0x.headcoders.net
; The idea is simple. OllyDBG interprets PAGE_GUARD as a
; Memory break-point. If we set SEH and execute PAGE_GUARDed
; code exception will occure. If debugger is present it
; will execute MemBpx and continue executing code after it.
; If debugger is not present handleing will be forwarded to SEH.
; Setup SEH
ASSUME FS:NOTHING
PUSH offset @Check
PUSH FS:[0]
MOV FS:[0],ESP
; Allocate new space
PUSH PAGE_READWRITE
PUSH MEM_COMMIT
PUSH 10000h
PUSH 0
CALL VirtualAlloc
; Write RET there
MOV BYTE PTR[EAX],0C3h
MOV DWORD PTR[Alloc],EAX
; Place Memory break-point
PUSH offset OLDProtect
PUSH PAGE_EXECUTE_READ OR PAGE_GUARD
PUSH 00000010h
PUSH EAX
CALL VirtualProtect
; Execute
CALL [Alloc]
PUSH 30h
PUSH offset msgTitle
PUSH offset msgText2
PUSH 0
CALL MessageBox
PUSH 0
CALL ExitProcess
; SEH handler
@Check:
POP FS:[0]
ADD ESP,4
PUSH 40h
PUSH offset msgTitle
PUSH offset msgText1
PUSH 0
CALL MessageBox
PUSH 0
CALL ExitProcess
end start
|
|
|
|
There are 31,320 total registered users.
|
|